package searchlogic

import (
	"math"
	"strings"
)

func prehandleTxt(strItem string) string {
	fullChars := []rune(
		"ａｂｃｄｅｆｇｈｉｊｋｌｍｎｏｐｑｒｓｔｕｖｗｘｙｚ" +
			"ＡＢＣＤＥＦＧＨＩＪＫＬＭＮＯＰＱＲＳＴＵＶＷＸＹＺ" +
			"！：﹡")
	halfChars := []rune(
		"abcdefghijklmnopqrstuvwxyz" +
			"ABCDEFGHIJKLMNOPQRSTUVWXYZ" +
			"!:*")
	len := int(math.Min(float64(len(fullChars)), float64(len(halfChars))))
	for i := 0; i < len; i++ {
		strItem = strings.ReplaceAll(strItem, string([]rune{fullChars[i]}), string([]rune{halfChars[i]}))
	}
	return strings.TrimSpace(strings.ToLower(strItem))
}
